<form action="add" method="post" Name="f_register">
<?php echo $this->formHidden("hdn_update","",null); ?>
<?php  
		define("CONST_FULL_NAME","Họ và tên");
		define("CONST_USER_NAME","Tên đăng nhập");
		define("CONST_PASS","Mật khẩu");
		define("CONST_REPASS","Nhắc lại mật khẩu");
		define("CONST_EMAIL","Email");
		define("CONST_ID_CAD","Số chứng minh thư");
		define("CONST_ID_REGISTER","Mã xác nhận");            
		?>
	<div class="title_bg_dangky">
         <p>Đăng ký tài khoản</p>
    </div>

    <table width="100%" class="login_form" cellpadding="0" cellspacing="0">	
		<col width="25%"><col width="75%">
		<tr  style="height: 25px;">
			<td class="normal_label_net"><?php echo CONST_FULL_NAME;?><small class="small_starmark">*</small></td>
			<td><input Name="txt_fullname" type="text" class="normal_textbox_net" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" message ="Chua nhap ho ten!" value="<?php echo $this->fullname; ?>" optional="false"></td>					
		</tr>
		<tr style="height: 25px;">
			<td class="normal_label_net" ><?php echo CONST_USER_NAME;?><small class="small_starmark">*</small></td>
			<td><input Name="txt_username" type="text" class="normal_textbox_net" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" message = "Chua nhap ten dang nhap" value="<?php echo $this->username; ?>"  optional="false"></td>
		</tr>
		<tr style="height: 25px;">
			<td class="normal_label_net" ><?php echo CONST_PASS;?><small class="small_starmark">*</small></td>
			<td><input Name="txt_password" Type="password" value="<?php echo $this->password?>" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" class="normal_textbox_net" minlength="6" message = "Mat khau phai co it nhat 6 ky tu"  optional="false"></td>
		</tr>
		<tr style="height: 25px;">
			<td class="normal_label_net" ><?php echo CONST_REPASS;?><small class="small_starmark">*</small></td>
			<td><input Name="txt_repassword" Type="password" value="<?php echo $this->repassword?>" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" class="normal_textbox_net" message = "Chua nhac lai mat khau"  optional="false"></td>
		</tr>
		<tr style="height: 25px;">
			<td class="normal_label_net" ><?php echo CONST_EMAIL;?><small class="small_starmark">*</small></td>
			<td><input Name="txt_email" id="txt_email" isemail = "true" type="text" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" class="normal_textbox_net" optional="false" value="<?php echo $this->email; ?>" ></td>
		</tr>
		<tr style="height: 25px;">
			<td class="normal_label_net" ><?php echo CONST_ID_CAD;?></td>
			<td><input Name="txt_scmnd" type="text" class="normal_textbox_net" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" optional="true" value="<?php echo $this->socmnd; ?>" ></td>
		</tr>
		<tr style="height: 25px;">
			<td class="normal_label_net" >Nhập mã xác nhận <small class="small_starmark">*</small></td>
			<td><input Name="txt_registex" type="text" value="" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" class="normal_textbox_net" message = "Hay nhap ma xac nhan!" ></td>
		</tr>
        <tr style="height: 44px;">
			<td class="normal_label_net" valign="center"><?php echo CONST_ID_REGISTER;?></td>
			<td>
				<div id="div_captcha" style="width:80%;display: inline;"></div>
				<span class="refresh-captcha" onclick="getcaptcha();" style="cursor: pointer;"></span>
			</td>
		</tr>
		<tr style="height: 50px;">
			<td></td>
			<td class="border-login" style=" float:left">
			<input Type="button" Name="btn_register" class="add_large_button_net" value="Tạo tài khoản" onKeyDown="change_focus_on_firefox(document.forms['f_register'],this,event)" onClick= "btn_register_update('');" >
			</td>
		</tr>
	</table>
		
</form>
<style type="text/css">
	table.login_form tr td input{
		width: 60%;
	}
	table.login_form tr td input.add_large_button_net{ width: auto;}
</style>
<script language="JavaScript">
getcaptcha();
function getcaptcha(){
	var p_url = baseUrl + '/web/user/getcaptcha/';
	$.ajax({
		url: p_url,type: 'POST',dataType: 'html',
		success: function(data){
			if(data != ''){
				$('#div_captcha').html(data);
			}
		}
	});
}
function checkcaptcha(actionName){
	var p_url = baseUrl + '/web/user/checkcaptcha/';
	var v_input = document.f_register.txt_registex.value;
	$.ajax({
		url: p_url,type: 'POST',dataType: 'html',
		data: '&v_input='+v_input,
		success: function(data){
			if(data != ''){
				if(data=='1'){
					$("#hdn_update").attr("value",1);
					actionUrl(actionName);				
				}else{
					alert("Mã xác nhận không đúng");	
					document.f_register.txt_registex.focus();
					return false;				
				}
			}
		}
	});
}
set_focus(document.forms[0]);
function btn_register_update(actionName){	
	//_save_xml_tag_and_value_list(document.forms["f_register"],document.forms["f_register"].hdn_list_xml_tag,document.forms["f_register"].hdn_list_xml_value,false);		
	var v_email_add = document.f_register.txt_email.value;
	var v_cmnd_value = document.f_register.txt_scmnd.value;	
	var v_pass = document.f_register.txt_password.value;
	if (verify(document.forms["f_register"])){
		if(v_pass!= "" && v_pass.length < 6){
			alert("Mật khẩu phải lớn hơn hoặc bằng 6 ký tự!");	
			document.f_register.v_pass.focus();
			return false;
		}	
		if (document.forms["f_register"].txt_password.value != document.forms["f_register"].txt_repassword.value){
			alert("Mật khẩu không đúng!");			
			document.forms["f_register"].txt_repassword.value="";
			document.forms["f_register"].txt_repassword.focus(); return;
		}
		if(!isemail(v_email_add) && v_email_add!= "" ){
			alert("Địa chỉ Email không đúng định dạng!");	
			document.f_register.txt_email.focus();
			return false;
		}		
		if(v_cmnd_value!= "" && v_cmnd_value.length < 9){
			alert("Số CMND không hợp lệ!");	
			document.f_register.txt_scmt.focus();
			return false;
		}
		checkcaptcha(actionName);
	}
}
</script>